<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Class to select all existing bills ductobarra
	*/
	class CommandSelectBillsDuctobarra extends CustomCommand {
		/*
		 * Constructor of the class
		 */
		public function __construct() {
				
		}
		
		/*
		 * Method to execute to select all existing Bills ductobarra
		 */
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$irad = $daoFactory -> getMySqlBillAccessDao();			
			$sentence = $irad -> selectBillsDuctobarra();
			
			$bills = ''; $i = 0;
			while ($row = mysql_fetch_array($sentence)) {
			
				$bills['pk_number'][$i] = $row['pk_number'];
				$bills['pk_control_number'][$i] = $row['pk_control_number'];
				$bills['date'][$i] = $row['date'];
				$bills['pk_id_number'][$i] = $row['pk_id_number'];
				$bills['first_name'][$i] = $row['first_name'];
				$bills['first_last_name'][$i] = $row['first_last_name'];
				$bills['email_address'][$i++] = $row['email_address'];
				
			}			
				$GLOBALS['debug']->log('Funcion que llama al DAO');
			$this -> result = $bills;
		}
	}
?>